#ifndef DDAS_WORKGEN_H
#define DDAS_WORKGEN_H

#include "ddas_definitions.h"

//if researcher(s) have dropped off new problem(s) return 1 else 0
int exists_new_work();


//fetch the problem IDs (pids) via a MySQL call
int fetch_problem_ids(int* pids);


//initialize 'data_content' and 'data_name' of a single problem ID, 'pid' based on the related data file 
int get_related_data_file(int pid, char* data_content, char* data_name);


//initialize variables via a MySQL call
int init_from_database(long pid, long* uid, long* numX, long* numY, long* numRows, long* numResults);


//create and return the appropriate scoping files given a problem ID
int get_related_scoping_files(int pids, int* scoping_file_size, char** scoping_files_content, char** scoping_file_names);


//serialize DDAS problem data (client input) files to appropriate hierarchical download directory
char* write_data_file_to_download_dir(char* file, char* name);


//serialize DDAS problem scoping files to the appropriate hierarchical download directory
char** write_scoping_files_to_download_dir(int size, char** files, char** names);


//serialize 'data' to a file defined by 'path'
int write_to_file(char* data, char* path);


//create workunits in the BOINC/DDAS database given the problem ID (pid), the # of scoping files, the names of the scoping files, and the scoping file contents
void create_workunits(int pid, int scoping_file_names_size, char* data_file_name, char** scoping_file_names);


//return the size of a file located at 'path'
long get_file_size(char* path);


#endif
